﻿package mortal.game.view.chat.chatPrivate
{
    import Message.Game.*;
    import Message.Public.*;
    import extend.language.*;
    import mortal.common.global.*;
    import mortal.game.cache.*;
    import mortal.game.scene3D.layer3D.utils.*;
    import mortal.game.view.chat.chatPanel.*;
    import mortal.game.view.chat.chatViewData.*;
    import mortal.game.view.chat.data.*;
    import mortal.game.view.platform.*;

    public class ChatData extends Object
    {
        public var chatFromPlayerName:String;
        public var fromMiniPlayer:SMiniPlayer;
        public var chatWindowName:String;
        public var chatWindowEntityId:SEntityId;
        public var crossFlag:Boolean = false;
        public var date:Date;
        public var content:String;
        public var force:int;
        public var typeArea:String;
        public var sChatMsg:SChatMsg;
        public var chatColor:uint;
        public var faceAuthority:int = 3;
        public var itemList:Array;
        public var petList:Array;
        public var chatTitleType:String;
        public var titleColor:int;
        public var fontSize:int = 12;
        public var guildPost:int = 0;
        public var alyzType:int = 0;
        public var jsObj:Object;

        public function ChatData()
        {
            return;
        }// end function

        public function copyFromChatMsg(param1:SChatMsg) : void
        {
            var _loc_2:Object = null;
            var _loc_3:int = 0;
            var _loc_4:Object = null;
            var _loc_5:String = null;
            var _loc_6:Array = null;
            var _loc_7:Object = null;
            this.chatFromPlayerName = param1.fromPlayer.name;
            this.fromMiniPlayer = param1.fromPlayer;
            this.sChatMsg = param1;
            this.date = param1.chatDt;
            this.content = param1.content;
            this.chatColor = param1.font;
            this.force = param1.force;
            this.sChatMsg = param1;
            this.alyzType = param1.chatType == EChatType._EChatTypeGuildBattle ? (1) : (0);
            this.faceAuthority = FaceAuthority.getMiniPlayerAuthority(param1.fromPlayer);
            if (param1.jsStr)
            {
                _loc_2 = JSON.parse(param1.jsStr);
                if (PlatformConst.isQQ())
                {
                    _loc_3 = ParamsConst.instance.enterType;
                    _loc_4 = JSON.parse(param1.jsStr);
                    _loc_5 = "tx_" + String(_loc_3);
                    this.jsObj = new Object();
                    if (_loc_4 && _loc_4[_loc_5])
                    {
                        _loc_6 = String(_loc_4[String(_loc_5)]).split("#");
                        this.jsObj.proxyLv = _loc_6[0];
                        this.jsObj.proxyExtend = _loc_6[1];
                        this.jsObj.proxyExtend2 = _loc_6[2];
                    }
                }
                else
                {
                    this.jsObj = _loc_2;
                }
            }
            if (param1.chatType == EChatType._EChatTypePrivate)
            {
                if (!EntityUtil.equal(Cache.instance.role.entityInfo.entityId, param1.fromPlayer.entityId))
                {
                    this.chatWindowName = param1.fromPlayer.name;
                    this.chatWindowEntityId = param1.fromPlayer.entityId;
                }
                else
                {
                    this.chatWindowName = param1.toPlayer;
                    this.chatWindowEntityId = param1.toEntityId;
                }
            }
            else if (param1.chatType == EChatType._EChatTypeGuild || param1.chatType == EChatType._EChatTypeGuildRoll || param1.chatType == EChatType._EChatTypeGuildBattle)
            {
                this.chatWindowName = Language.getString(11508);
                this.chatWindowEntityId = Cache.instance.role.entityInfo.entityId;
            }
            this.typeArea = ChatMessageWorking.getNameByChatType(param1.chatType);
            this.chatTitleType = ChatMessageWorking.getChatTypeByAreaName(this.typeArea);
            if (this.chatTitleType == ChatType.Secret)
            {
                this.titleColor = param1.font;
            }
            else
            {
                this.titleColor = ChatStyle.getTitleColor(this.chatTitleType);
            }
            if (!this.chatColor)
            {
                this.chatColor = this.titleColor;
            }
            if (param1.contentEx)
            {
                _loc_7 = JSON.parse(param1.contentEx);
                if (_loc_7["gp"])
                {
                    this.guildPost = _loc_7["gp"];
                }
            }
            return;
        }// end function

        public function isSelfMsg() : Boolean
        {
            return EntityUtil.equal(Cache.instance.role.entityInfo.entityId, this.fromMiniPlayer.entityId);
        }// end function

    }
}
